package course_platform;

import java.util.ArrayList;
import java.util.List;

public class Teacher extends Person {
    private List<Course> courses; // 所授课程列表

    public Teacher(String id, String name, String gender) {
        super(id, name, gender);
        this.courses = new ArrayList<>();
    }

    public List<Course> getCourses() {
        return courses;
    }

    public void addCourse(Course course) {
        if (!courses.contains(course)) {
            courses.add(course);
            course.addTeacher(this);
        }
    }

    @Override
    public void printSchedule() {
        System.out.println("教师课表：\n");
        for (Course course : courses) {
            System.out.println("课程编号:" + course.getCode() + ", 课程名称:" + course.getCourseName() +
                    ", 上课地点:" + course.getLocation() + ", 时间:" + course.getTime());
        }
        System.out.println();
    }
}